<?php
namespace Admin\Controller;
use Think\Controller;
/**
 * Created by PhpStorm.
 * User: zhaojia
 * Date: 15-9-1
 * Time: 下午2:04
 */
class MyInfoController extends CommonController{
    private $_model;
    function _initialize(){
        $this->_model=D('MyInfo');
    }
    public function index(){
        if(IS_POST){
         $data=$_POST;
         $this->_model->add_data($data);
         $this->error("添加成功");

        }
        $this->display();
    }

    public function my(){
        $data= $this->_model->get_data();
        $this->assign('data',$data);
        $this->display();
    }

    public function edit(){
        if($_POST){
            $data=$_POST;
            $where=array('id'=>2);
            $this->_model->save_data($where,$data);

            $this->error("修改成功！");
        }
       $data= $this->_model->get_data();
       $this->assign('data',$data);
        $this->display();
    }

}